package com.test.noahphan;

import android.app.Activity;
import android.app.AlertDialog;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class Hello extends Activity {
	EditText editUsr;
	Button btnChao;

	OnClickListener onClick = new OnClickListener() {

		@Override
		public void onClick(View v) {
			AlertDialog.Builder ab = new AlertDialog.Builder(Hello.this);
			ab.setTitle("AlertDialog.Builder");
			ab.setMessage("Using AlertDialog.Builder. Compare with AlertDialog?");
			ab.setPositiveButton("OK", null);
			ab.show();
		}
	};

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.hello);
		editUsr = (EditText) findViewById(R.id.editUsr);

		Bundle b = this.getIntent().getExtras();
		if (b != null) {
			editUsr.setText(b.getString("1"));
		} else {
			editUsr.setText("Default User");
		}
		btnChao = (Button) findViewById(R.id.btnChao);
		btnChao.setOnClickListener(onClick);

	}

}
